/********* USE unbalanced dataset *********/

/* Baseline Regression: Table 2-3 */
set cformat %9.3f
/* In-state enrollment */
xtivreg PER_INSTATE4 (ln_INSTATE_TUI ln_OUTSTATE_TUI = BARTIK_INSTATE_WHOLE BARTIK_OUTSTATE_WHOLE) ///
PER_RETENTION ln_TOTAL_OTHER_ENROLL ln_PER_INC ln_TOTAL_POP_1824_HS ln_TOTAL_POP65OVER ///
ln_EMP_LABOR_RATIO_1619 dum2 dum3 dum4 dum5 dum6 dum7 dum8 dum9 dum10 dum11, fe vce(cluster ID)

/* Out-of-state enrollment */
xtivreg PER_OUTSTATE4 (ln_INSTATE_TUI ln_OUTSTATE_TUI = BARTIK_INSTATE_WHOLE BARTIK_OUTSTATE_WHOLE) ///
PER_RETENTION ln_TOTAL_OTHER_ENROLL ln_PER_INC ln_TOTAL_POP_1824_HS ln_TOTAL_POP65OVER ///
ln_EMP_LABOR_RATIO_1619 dum2 dum3 dum4 dum5 dum6 dum7 dum8 dum9 dum10 dum11, fe vce(cluster ID)

xtoverid,noi


/* Baseline Regression: Table 4 and 6
add CARNEGIE < 18 - For Doctoral institutions
    CARNEGIE > 17 - For other institutions

add AVR_ADMIT_RATE <= 60 - For highly selective institutions
    AVR_ADMIT_RATE > 60 - For less selective institutions */
	
	
/* Baseline Regression: Table 5 
Change dependent variable to PER_INSTATE4 for in-state enrollment
                             PER_OUTSTATE_PURE4 for regular out-of-state enrollment
					         PER_EXCHANGE4 for out-of-state exchange student enrollment */
					  

/* Sensitivity estimates: Table 7
Additional non-lagged controls: ln_TOTAL_EXP_PER ln_STATE_APP_PER
Additional lagged controls: ln_LAG_TOTAL_EXP_PER ln_LAG_STATE_APP_PER */

/* Sensitivity estimates: Table 9
Chage independent variables to ln_INSTATE_NET_TUI ln_OUTSTATE_NET_TUI for in-state and out-of-state tuition, repectively */


/********* USE balanced dataset *********/
/* Sensitivity estimates: Table 8 */

/** First difference **/
/* In-state enrollment */
xtivreg DPER_INSTATE4 (Dln_INSTATE_TUI Dln_OUTSTATE_TUI = DBARTIK_INSTATE_WHOLE DBARTIK_OUTSTATE_WHOLE) ///
DPER_RETENTION Dln_TOTAL_OTHER_ENROLL Dln_PER_INC Dln_TOTAL_POP_1824_HS Dln_TOTAL_POP65OVER ///
Dln_EMP_LABOR_RATIO_1619 dum3 dum4 dum5 dum6 dum7 dum8 dum9 dum10 dum11, fe vce(cluster ID)

/* Out-of-state enrollment */
xtivreg DPER_OUTSTATE4 (Dln_INSTATE_TUI Dln_OUTSTATE_TUI = DBARTIK_INSTATE_WHOLE DBARTIK_OUTSTATE_WHOLE) ///
DPER_RETENTION Dln_TOTAL_OTHER_ENROLL Dln_PER_INC Dln_TOTAL_POP_1824_HS Dln_TOTAL_POP65OVER ///
Dln_EMP_LABOR_RATIO_1619 dum3 dum4 dum5 dum6 dum7 dum8 dum9 dum10 dum11, fe vce(cluster ID)

/** 2SLS **/
/* In-state enrollment */
xtivreg PER_INSTATE4 (ln_INSTATE_TUI ln_OUTSTATE_TUI = BARTIK_INSTATE_WHOLE BARTIK_OUTSTATE_WHOLE) ///
PER_RETENTION ln_TOTAL_OTHER_ENROLL ln_PER_INC ln_TOTAL_POP_1824_HS ln_TOTAL_POP65OVER ///
ln_EMP_LABOR_RATIO_1619 dum2 dum3 dum4 dum5 dum6 dum7 dum8 dum9 dum10 dum11, fe vce(cluster ID)

/* Out-of-state enrollment */
xtivreg PER_OUTSTATE4 (ln_INSTATE_TUI ln_OUTSTATE_TUI = BARTIK_INSTATE_WHOLE BARTIK_OUTSTATE_WHOLE) ///
PER_RETENTION ln_TOTAL_OTHER_ENROLL ln_PER_INC ln_TOTAL_POP_1824_HS ln_TOTAL_POP65OVER ///
ln_EMP_LABOR_RATIO_1619 dum2 dum3 dum4 dum5 dum6 dum7 dum8 dum9 dum10 dum11, fe vce(cluster ID)
